//
//  RoadLineVC.m
//  TT
//
//  Created by Lenny on 16/5/6.
//  Copyright © 2016年 Lenny. All rights reserved.
//

#import "RoadLineVC.h"
#import "RoadLineCell.h"

@interface RoadLineVC ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property(nonatomic,strong)UICollectionView *lineCV;

@end

@implementation RoadLineVC

#pragma mark - life cycle

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view;
    
    self.view.backgroundColor = WL_Back_Gray_Color;
    [self UI];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    self.title = @"最快路线";
    
}

#pragma mark - delegate motheds

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return 10;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    RoadLineCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"lineCell" forIndexPath:indexPath];
    return cell;
}

#pragma mark - private motheds 
- (void)UI {
    
    [self.view addSubview:self.lineCV];
    
    [self.lineCV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
}

#pragma mark - setters and getters
- (UICollectionView *)lineCV {
    
    if (_lineCV == nil) {
        
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        flowLayout.itemSize = CGSizeMake(k_screen_w, 200);
        _lineCV = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
        _lineCV.delegate = self;
        _lineCV.dataSource = self;
        _lineCV.backgroundColor = WL_Back_Gray_Color;
        [_lineCV registerClass:[RoadLineCell class] forCellWithReuseIdentifier:@"lineCell"];
    }
    return _lineCV;
}



@end
